package com.enterprise.web;

import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.assg2.dao.*;
import com.movie.Owner;
import com.movie.Viewer;
import javax.servlet.http.HttpSession;

/**
 * This is the command that will be used for logging in users.
 * If logon is successful, the command should place a list of contacts
 * in the request attriubutes.
 * @author  yunki
 */
public class SearchCommand implements Command {

    /** Creates a new instance of LoginCommand */
    public SearchCommand() {
    }

    public String execute(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        //TODO: set the response content type to "text/html" here
        //TODO: You'll have to use getWriter() to output some HTML texts
        //TODO: close the output stream

        response.setContentType("text/html");// from response, set content type
        PrintWriter out = response.getWriter();// from response, get output writer

        HttpSession session = request.getSession(true);
        String from = request.getParameter("from");
//        return "//header.html").include(request, response);
//        out.write("<h1>Search movie</h1>");
//        out.write("<a href='searchbytitle.jsp'>Search by title</a>");
//        out.write("<a href='SearchByActor'>actors/actresses</a>");
//        out.write("<a href='searchbygenres.jsp'>Search by genres</a>");
//        return "//footer.html").include(request, response);
        return "/search.jsp";
    }
}
